﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsaGame1
{
    class Menu : SceneBase
    {

        KeyboardState teclado;
        //KeyboardState tecladoAntigo;
        MouseState mouse;
        MouseState mouseAntigo;

        static public SpriteFont caixaTXT;
        static public SpriteFont titulo;
        static public Vector2 textPosition;

        Objeto2D fundoMenu;

        Rectangle boxSelection;


        public override void start()
        {

            fundoMenu = new Objeto2D(Game1.Self.Content.Load<Texture2D>("spacemenu"));
            fundoMenu.posicao = new Vector2 (Game1.Self.Window.ClientBounds.Width / 2, Game1.Self.Window.ClientBounds.Height / 2);

            caixaTXT = Game1.Self.Content.Load<SpriteFont>(@"SpriteFont1");
            textPosition = new Vector2(Game1.Self.GraphicsDevice.Viewport.Width / 2,Game1.Self.GraphicsDevice.Viewport.Height / 2);
            titulo = Game1.Self.Content.Load<SpriteFont>(@"NomeJogo");
            //titulo = Game1.Self.Content.Load<SpriteFont>("Arial");

            boxSelection = new Rectangle((int)textPosition.X, (int)textPosition.Y, Game1.Self.GraphicsDevice.Viewport.Width, Game1.Self.GraphicsDevice.Viewport.Height); 
        }

        public override void update(GameTime gameTime)
        {

            teclado = Keyboard.GetState();
            mouse = Mouse.GetState();


            if (teclado.IsKeyDown(Keys.Enter))
            {
                SceneManager.setScene(new Level1());
                Console.WriteLine("Estou no level 1");
            }

            
            
            
            
            if (mouse.LeftButton == ButtonState.Pressed &&
                mouseAntigo.LeftButton == ButtonState.Released)
            {
                


            }
            
        }

        public override void draw(SpriteBatch spriteBatch)
        {


            fundoMenu.Draw(spriteBatch);
            
            spriteBatch.DrawString(titulo, "Space Colision", new Vector2(200.0f, 150.0f), Color.Red);
            
            //spriteBatch.DrawString(caixaTXT, "Olá Mundo!", new Vector2(100.0f, 200.0f), Color.White);  

            var output = "Clique Enter para começar";
            Vector2 offset = caixaTXT.MeasureString(output) / 2;
            spriteBatch.DrawString(caixaTXT, output, textPosition, Color.Yellow, 0, offset, 1.0f, SpriteEffects.None, 0.5f);
            
            


        }

        public override void terminate()
        {
            
        }

    }
}
